<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="../../vue.js"></script>
</head>

<body>
  <div id="app">
    <h1>{{msg}}</h1>
    <p :style="style">style动态属性1(对象)</p>
    <p :style="styleArr">style动态属性2(数组)</p>
    <p style="width: 200px;height: 200px;" :style="{background:backgroundcolor}">style动态属性3(共存)</p>
  </div>
  <script>
    Vue.config.productionTip = false;
    const vm = new Vue({
      el: "#app",
      data() {
        return {
          msg: "hello vue!",
          //样式对象
          style: {
            width: "200px",
            height: '200px',
            background: 'red'
          },
          //样式对象组成的数组
          styleArr: [{
              width: '200px'
            },
            {
              height: '200px'
            },
            {
              background: 'blue'
            }
          ],
          //单个对象
          backgroundcolor: 'yellow'
        }
      },
      methods: {}
    })
    console.log(vm, 'vm');
  </script>
</body>

</html>